-- This script shows off some of the things Pfhortran can do with cameras.
-- It starts with a moving camera, switches to a static camera, and then
-- later links a cut-scene to a switch and hides the HUD.
-- There is really no "algorithm" involved: the script only loops
-- until the switch has been thrown.
-- Version: 1

_report_errors true

_procedure init                     -- Init stuff
state: def 0                        -- state of the tag
count: def 0                        -- counter for camera-move loop
posx: def 0                         -- xyz variables for camera
posy: def 0
posz: def 0

Init_Cameras 3                      -- we will have 3 custom cameras

Select_Camera 1                     -- select the first camera
Set_Camera_Poly 8                   -- set polygon for camera 1
Set_Camera_Pos 0.506, -2.8, 1.6     -- set xyz location for camera 1
Set_Camera_YP -148.359, -21.094     -- set yaw/pitch for camera 1

Select_Camera 2                     -- select camera 2
Set_Camera_Poly 57                  -- set polgon for camera 2
Set_Camera_Pos -3.581, -2.409, 0.6  -- set xyz location for camera 2
Set_Camera_YP -29.531, 0            -- set yaw/pitch for camera 1

Select_Camera 3                     -- do pretty much the same thing
Set_Camera_Poly 16                  -- but for camera 3 :)
Set_Camera_Pos 0.383, -5.5, 0.6
Set_Camera_YP 125.859, 0

Add_Item magnum                     -- Arm another pistol
Add_Item magnum_magazine            -- And some ammo
Add_Item magnum_magazine

set posx, -3.581                    -- setup vars for scrolling camera 2
set posy, -2.409
set posz, 0.6
set count, 0
Use_Camera 2                        -- start using camera 2

end                                 -- done with init

_procedure idle
block_start         
scroll: block_end
block_start 
wait_ticks 1                    
subtract posy, 0.01                 -- move camera .01 units left
Set_Camera_Pos posx, posy, posz     -- set new location
add count, 1     

if_> count, 100, next               -- do this 100 times
jump scroll

next: block_end
Use_Camera 1                        -- select our static camera
wait_ticks 350                      -- focus there for a few seconds
Use_Camera default_camera           -- select normal (player) camera
checkbtn: get_tag_state 1, state    -- check the button's state
if_= state, TRUE, open              
jump checkbtn
open: block_start
Hide_Interface                      -- it it was clicked, hide the hud
Use_Camera 3                        -- switch cameras
block_end
wait_ticks 300                      -- wait (can't be in the block!!)
block_start
Use_Camera default_camera           -- return to normal camera
Show_Interface                      -- show the hud
block_end
script_end                          -- end the script -- we're done
end
